//
//  YJBThirdLoginView.m
//  YunJiaBaoFirst
//
//  Created by 腾云小白龍 on 16/7/26.
//  Copyright © 2016年 腾云小白龍. All rights reserved.
//

#import "YJBThirdLoginView.h"

@implementation YJBThirdLoginView

-(void)YJBThirdLoginView:(YJBThirdLoginView *)view{
    UIView *contentView = [[UIView alloc]initWithFrame:view.bounds];
    [view addSubview:contentView];
    CGFloat scale = contentView.frame.size.height/120;
    CGFloat fontSize = 13;
    if ([UIScreen mainScreen].bounds.size.height == 480) {
        fontSize = 11;
    }
    
    UIImageView *imgView = ({
        UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 2, contentView.frame.size.width,scale* 30)];
        imgView.image = [UIImage imageNamed:@"pointLine"];
        imgView;
    });
    [contentView addSubview:imgView];
    
    UILabel *label = ({
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake((contentView.frame.size.width - 150)/2, 0, 150,scale* 30)];
        label.textAlignment = NSTextAlignmentCenter;
        label.text = @"第三方无需注册,直接登陆";
        label.font = [UIFont systemFontOfSize:10];
        label.textColor = KColorWithRGBA(140, 137, 138, 1);
        label;
    });
    [contentView addSubview:label];
    
    
    int margin = [UIScreen mainScreen].bounds.size.width * 50/375 *scale;
    CGFloat x = (contentView.frame.size.width -scale * 70*3 - margin *2)/2 ;
    self.qqLoginBtn = ({
        UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(x, CGRectGetMaxY(label.frame) + 10,scale* 70,scale* 70)];
        [button setImage:[UIImage imageNamed:@"QQLogo"] forState:UIControlStateNormal];

        [button setTitleColor:KColorWithRGBA(140, 137, 138, 1) forState:UIControlStateNormal];
        button.contentHorizontalAlignment = UIControlContentVerticalAlignmentCenter;
        [contentView addSubview:button];

        button;
    });
    
    UILabel *QQlabel = ({
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(x, CGRectGetMaxY(self.qqLoginBtn.frame),scale* 70, 22)];
        label.textAlignment = NSTextAlignmentCenter;
        label.text = @"QQ登陆";
        label.font = [UIFont systemFontOfSize:fontSize];
        label.textColor = KColorWithRGBA(140, 137, 138, 1);
        label;
    });
    [contentView addSubview:QQlabel];
    
    self.weiXinLoginBtn = ({
        UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.qqLoginBtn.frame) + margin, CGRectGetMaxY(label.frame) + 10,scale* 70,scale* 70)];
        [button setImage:[UIImage imageNamed:@"weiXinLogo"] forState:UIControlStateNormal];
        
        [button setTitleColor:KColorWithRGBA(140, 137, 138, 1) forState:UIControlStateNormal];
        button.contentHorizontalAlignment = UIControlContentVerticalAlignmentCenter;
        [contentView addSubview:button];
        
        button;
    });
    
    UILabel *weiXinlabel = ({
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(self.weiXinLoginBtn.frame.origin.x, CGRectGetMaxY(self.weiXinLoginBtn.frame),scale* 70, 22)];
        label.textAlignment = NSTextAlignmentCenter;
        label.text = @"微信登陆";
        label.font = [UIFont systemFontOfSize:fontSize];
        label.textColor = KColorWithRGBA(140, 137, 138, 1);
        label;
    });
    [contentView addSubview:weiXinlabel];
    
    self.weiBoLoginBtn = ({
        UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.weiXinLoginBtn.frame) + margin, CGRectGetMaxY(label.frame) + 10,scale* 70,scale* 70)];
        [button setImage:[UIImage imageNamed:@"weiBoLogo"] forState:UIControlStateNormal];
        
        [button setTitleColor:KColorWithRGBA(140, 137, 138, 1) forState:UIControlStateNormal];
        button.contentHorizontalAlignment = UIControlContentVerticalAlignmentCenter;
        [contentView addSubview:button];
        
        button;
    });
    
    UILabel *weibolabel = ({
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(self.weiBoLoginBtn.frame.origin.x, CGRectGetMaxY(self.weiXinLoginBtn.frame),scale* 70, 22)];
        label.textAlignment = NSTextAlignmentCenter;
        label.text = @"微博登陆";
        label.font = [UIFont systemFontOfSize:fontSize];
        label.textColor = KColorWithRGBA(140, 137, 138, 1);
        label;
    });
    [contentView addSubview:weibolabel];
}

@end
